package com.wyu.blog.dao;

import com.wyu.blog.entity.Article;
import com.wyu.blog.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * Created by hgq on 2020/2/1.
 */
@Mapper
@Repository
@Qualifier("dbSqlSessionTemplate")
public interface UserMapper{

    /**
     * 通过名字查询用户信息
     */
    User selectUserByName(String name);

    /**
     * 查询所有用户信息
     */
    List<User> selectAllUser();


    /**
     * 添加用户
     */
    Integer insertUser(User user);

    /**
     * 添加Github用户
     */
    Integer insertGithubUser(User user);

    /**
     * 后台添加用户
     */
    Integer insertUserByBack(User user);

    /**
     * 查询用户的所有文章
     */
    List<Article> selectAllArticle(Integer userId);

    Integer deleteUserById(Integer userId);

    User selectUserByUserId(Integer userId);

    Integer updateByUserId(User user);

    Integer updatePassword(User user);

    Integer updatePhoto(User user);

    Integer updateByUser(User user);

    Integer updateUserById(User user);
}
